package com.task.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.task.interceptor.LoginHandlerInterceptor;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
	/**
	 * 不需要登录拦截的url
	 */
	final String[] notLoginInterceptPaths = { "/static/**","/", "/error/**","/druid/**", "/login" };

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new LoginHandlerInterceptor()).addPathPatterns("/**").excludePathPatterns(notLoginInterceptPaths);
	}
}
